#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :scenery.py
# @Time      :2023/10/26 
# @Author    :CL
# @email     :1037654919@qq.com
import re

import requests

def get_scenery(url = None):
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "no-cache",
        "Pragma": "no-cache",
        "Proxy-Connection": "keep-alive",
        "Referer": "http://www.lvmama.com/lvyou/d-shanghai79.html",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    }
    cookies = {
        "_ip_city_name": "%E4%B8%8A%E6%B5%B7",
        "_ip_city_place_id": "310000",
        "_ip_province_place_id": "310000",
        "uid": "wKgKb2U4c6DB6FY8N2IDAg==",
        "lvsessionid": "5e91e5ff-40d7-44d8-80c7-93b29dc8e917_16864194",
        "BDCCOOKIEID": "hrBhePbj3980950582",
        "BDCSESSIONID": "rSjdsWfeSHy1698217649443",
        "CoreID6": "88359017514216982176497&ci=52710000|PC",
        "Hm_lvt_cb09ebb4692b521604e77f4bf0a61013": "1698217650",
        "fp_ver": "4.5.1",
        "_ga": "GA1.2.481363095.1698217651",
        "_gid": "GA1.2.875696478.1698217651",
        "_jzqc": "1",
        "PHPSESSID": "21rbooo9huibt9r0drchq3h2h0",
        "cmTPSet": "Y",
        "_lvTrack_u_ud": "B014A4D3-920F-4CA4-A91C-ACAE28A90E01",
        "_qzjc": "1",
        "LVMM_NODE_ENV": "production",
        "oIC": "233198233198233198233198",
        "oIT": "0925092509250925",
        "_jzqx": "1.1698299990.1698299990.1.jzqsr=lvmama%2Ecom|jzqct=/lvyou/d-beijing1%2Ehtml.-",
        "_jzqa": "1.478980885840175800.1698217652.1698299990.1698306532.4",
        "_jzqckmp": "1",
        "_lvTrack_u_sd": "96837417-21F0-49C2-90C0-2A001AC2A6BA",
        "_lvTrack_firstVisitTime": "1698306676715",
        "_lvTrack_preVisitTime": "1698306676718",
        "__xsptplus443": "443.3.1698306806.1698306806.1%234%7C%7C%7C%7C%7C%23%23%23",
        "Hm_lpvt_cb09ebb4692b521604e77f4bf0a61013": "1698309180",
        "_qzja": "1.402745185.1698218091536.1698299990111.1698306531850.1698309034836.1698309180491.0.0.0.34.4",
        "_qzjto": "15.2.0",
        "_ga_NHEPS49S4W": "GS1.2.1698306534.4.1.1698309180.0.0.0",
        "_fmdata": "Lgnmwvb9UZV3dOw7baJRkFLIcqZ0qBmuoEw2PbzMKQxBloJQrAqlHMCiqafNRvHdieyI3tK7YJMoQzM5KMv6l6grwlEUert9bA5dJ0smQgc%3D",
        "52710000|PC_clogin": "v=37&l=1698306531&e=1698311270605",
        "jXVJUTNgMEfp6rEr": "Y8TsA8HIFqshVDwX3hF%2Bb8scXtcL0FXqu1ZdQZa5LJUGPC%2B75HZNhsQMCIYSdupZdojzSAZFXe4CxUdxrD4%2Fe2SBZ2dUzpx2EDqq%2BBlQgpGTrv3rj9VmQ2HDhRXfi7SVISdrY%2BoJJcXNsg2ygGgisCCr1%2Fqtv5Cd1X7BdH8YX4XYs%2Bspjoks0A3PfrUXDE9BK6iidIy3L8djQVhEcX3CbUti31rAVziiNYDB7enWvjvSAZbPx32M3EVvSoJEq2u6SDbl7WIssU25ePKDB92cNreK6LwcORADoE5w8fMKnHFWmKZutCPxQH1wtX048Hp1oyAb1rXQeAnsy8XIBScaHS4o6Y9REntogr0xR9Ym9HeU1ZqqJG%2FRyGUR56FuPwCJ3YkVkFrd%2FztSZRM9JpRbTzilDNIlm6GMi6bHrtLa29Q%3Dc5e98d29eeb1e05cd5c722ebcf4096cdb3645eb3",
        "JSESSIONID": "22EF16F0A729C3F342B75EA882D0D740",
        "sensorsdata2015jssdkcross": "%7B%22distinct_id%22%3A%2218b6483ae6e583-00a9889c6d2904-13462c6c-2073600-18b6483ae6f94b%22%2C%22%24device_id%22%3A%2218b6483ae6e583-00a9889c6d2904-13462c6c-2073600-18b6483ae6f94b%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E5%BC%95%E8%8D%90%E6%B5%81%E9%87%8F%22%2C%22%24latest_referrer%22%3A%22https%3A%2F%2Fblog.csdn.net%2Fqq_33854211%2Farticle%2Fdetails%2F78766621%3Fspm%3D1001.2101.3001.6650.2%26utm_medium%3Ddistribute.pc_relevant.none-task-blog-2%257Edefault%257ECTRLIST%257ERate-2-78766621-blog-129261872.235%255Ev38%255%22%2C%22%24latest_referrer_host%22%3A%22blog.csdn.net%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC%22%7D%7D"
    }
    if url == None:
        url = "http://www.lvmama.com/lvyou/scenery/d-shanghai79.html"
    response = requests.get(url, headers=headers,timeout=10, cookies=cookies)

    # print(response.text)
    print(response)
    if response.status_code == 200:
        return response.text
if __name__ == "__main__":
    response = get_scenery()
    # 使用正则表达式匹配 "base_id" 的值
    match = re.search(r'base_id\s*:\s*"(\d+)"', response)
    if match:
        base_id = match.group(1)
        print("base_id值为: " + base_id)
    else:
        print("未找到base_id值")